//
//  ByHomeCirclesVIew.m
//  caipiao_ios
//
//  Created by mc on 2018/7/13.
//  Copyright © 2018年 ZhangZhanbin. All rights reserved.
//

#import "ByHomeCirclesVIew.h"

@implementation ByHomeCirclesVIew

- (void)setIsStopSale:(BOOL)isStopSale{
    _isStopSale = isStopSale;
}


- (void)setItemsAry:(NSArray *)itemsAry{
    _itemsAry = itemsAry;
    [self.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
   
    CGFloat magin = 10;
    CGFloat width = (SCREEN_WIDTH - 45  - magin * 8 - 20) / 8.0;
    if (width > 28) {
        width = 28;
    }
    for (int i = 0;i < _itemsAry.count; i++) {
        ByNetModel *netModel = [_itemsAry objectAtIndex:i];
        UILabel *valueLabel = [[UILabel alloc] initWithFrame:CGRectMake(magin + i  * (width + magin), magin, width, width)];
        [self addSubview:valueLabel];
        valueLabel.layer.cornerRadius = width / 2.0;
        if (netModel.value < 10) {
            valueLabel.text = [NSString stringWithFormat:@"0%ld",netModel.value];
        }else{
            valueLabel.text = [NSString stringWithFormat:@"%ld",netModel.value];
        }
        
        valueLabel.tag = 100 + i;
        valueLabel.font = FONT(14);
        valueLabel.textAlignment = NSTextAlignmentCenter;
        valueLabel.layer.masksToBounds = YES;
        
       
        valueLabel.textColor = netModel.themeColor;
        valueLabel.layer.borderColor = netModel.themeColor.CGColor;
        valueLabel.layer.borderWidth = 1;
        
        if (_isStopSale) {
            valueLabel.textColor = [UIColor lightGrayColor];
            valueLabel.layer.borderColor = [UIColor lightGrayColor].CGColor;
        }
        
    }
}



@end
